CentOS 7
Sponsored Link

Docker : Use Docker-Registry#1
2015/12/17
 
Install Docker-Registry to build Private Registry for Docker images.
[1] Install Docker-Registry on a Host you'd like to configure as a Registry Server.
[root@dlp ~]#
yum -y install docker-registry
[root@dlp ~]#
vi /etc/docker-registry.yml
# line 19: add

search_backend: _env:SEARCH_BACKEND
:sqlalchemy
# line 21: specify DB file for search (change it if need)

sqlalchemy_index_database: _env:SQLALCHEMY_INDEX_DATABASE:sqlite:////tmp/docker-registry.db
# line 74: the directory to store images (change it if need)

storage_path: _env:STORAGE_PATH:/var/lib/docker-registry
# create a directory to store images

[root@dlp ~]#
mkdir /var/lib/docker-registry

[root@dlp ~]#
systemctl start docker-registry

[root@dlp ~]#
systemctl enable docker-registry
# make sure to be able to access

[root@dlp ~]#
curl localhost:5000

"\"docker-registry server\""
[2] When using Registry Server from Docker Nodes, Docker Service accesses with HTTPS by default, but if you'd like to access with HTTP, it needs to change settings on each Docker Node like follows.
For settings of HTTPS accessing, refer to here.
[root@node01 ~]#
vi /etc/sysconfig/docker
# line 23: uncomment and specify Docker-Registry server

INSECURE_REGISTRY='--insecure-registry
dlp.srv.world:5000
'
[root@node01 ~]#
systemctl restart docker
[3] After settings above, it's possible to use Registry Server.
The follows are for the case of pushing images to Registry Server.
# add a tag and push

[root@node01 ~]#
docker tag web_server dlp.srv.world:5000/httpd

[root@node01 ~]#
docker push dlp.srv.world:5000/httpd

[root@node01 ~]#
docker images

REPOSITORY                    TAG       IMAGE ID        CREATED              VIRTUAL SIZE
web_server                    latest    4d62ac763587    About a minute ago   282.8 MB
dlp.srv.world:5000/httpd   latest    4d62ac763587    About a minute ago   282.8 MB
docker.io/centos              latest    14dab3d40372    36 hours ago         194.7 MB
[4] The follows are for the case of pulling images from Registry Server.
[root@node02 ~]#
docker images

REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE

# search Registry Server with a word "httpd"

[root@node02 ~]#
docker search dlp.srv.world:5000/httpd

INDEX          NAME                                  DESCRIPTION   STARS     OFFICIAL   AUTOMATED
srv.world   dlp.srv.world:5000/library/httpd                 0

[root@node02 ~]#
docker pull dlp.srv.world:5000/httpd

[root@node02 ~]#
docker images

REPOSITORY                    TAG      IMAGE ID        CREATED             VIRTUAL SIZE
dlp.srv.world:5000/httpd   latest   4d62ac763587    14 minutes ago      282.8 MB
 
Tweet